package org.hegang.design.second.absfactory;

public class FactoryProducer {
    public static AbstractFactory getFactory(String factory) {
        if (factory.equalsIgnoreCase("color")) {
            return new ColorFactory();
        } else if ("shape".equalsIgnoreCase(factory)) {
            return new ShapeFactory();
        } else {
            throw new IllegalArgumentException("参数错误");
        }
    }
}
